home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / texts / hsc.lha / hsc / src_docs / macro / macros.hsc < prev   
Text File  |  1996-04-01  |  4KB  |  120 lines

  1. <WEBPAGE chapter="hsc - Features - " title="Macros"
  2.     PREV=":features/absuris.html"
  3.     NEXT=":features/rplcent.html">
  4.  
  5. Macros can be defined like
  6.  
  7. <BLOCKQUOTE><CODE><$MACRO</CODE> <I>MacroName</I>
  8.   [ <I><A HREF="flag.html">flags</A></I> ]
  9.   [ <I><A HREF="attrib.html">attributes</A></I> ]
  10.   <CODE>></CODE><BR>
  11.  
  12. <BR>
  13. <I>...macro text...</I><BR><BR>
  14.  
  15. <TG>/$MACRO</TG></BLOCKQUOTE>
  16.  
  17. Here are some examples of macro definitions:
  18.  
  19. <H2>Use as a shortcut</H2>
  20.  
  21. You can define a macro called <CODE>MyAddress</CODE> that only is a
  22. shortcut for your email-address like
  23.  
  24. <$INCLUDE FILE="exmpl/m_addr.hsc" SOURCE PRE> <* show macro *>
  25. <$INCLUDE FILE="exmpl/m_addr.hsc">            <* define macro *>
  26.  
  27. So every time, you insert the macro-tag <TG>MyAddress</TG>
  28. in your hsc-source, it will be replaced by
  29.  
  30. <PRE>
  31. <MyAddress>
  32. </PRE>
  33.  
  34. in the HTML-object.
  35.  
  36. <H2>Create your own logical style</H2>
  37.  
  38. <P>One of the most embarassing facts within HTML are physical/logical
  39. styles. Taking a look at the HTML 3.0 proposed things, you find
  40. loads of new styles: <TG>AU</TG> for authors, <TG>SAMP</TG> for
  41.     sequences of litteral characters
  42. and so on... No one knows where this will end, and I'm just waiting
  43. for logical styles like
  44. <TG>TIM_BERNERS_LEE_S_LOGICAL_STYLE_TO_RENDER_THE_NAME_OF_HIS_DOG</TG>.
  45. (Which would asume that TBL has a dog)</P>
  46.  
  47. Anyway, while other people think about which logical style should get his
  48. own tag and which not, you can define your own styles. For example, a
  49. logical style to render a filename could look like this:
  50.  
  51. <$INCLUDE FILE="exmpl/m_file.hsc" SOURCE PRE> <* show macro *>
  52. <* <FILE> is already defined within "inc/macro.hsc",
  53. ** so there is no need to include redefine it here
  54. *>
  55.  
  56. Your new style can be used like all other styles:
  57. <$source PRE>
  58.   ..open the file <FILE>hugo.txt</FILE> and..
  59. </$source>
  60.  
  61. In this case, filenames will be rendered <I>italic</I>:
  62.  
  63. <BLOCKQUOTE>
  64.   ..open the file <FILE>hugo.txt</FILE> and..
  65. </BLOCKQUOTE>
  66.  
  67. <P>This seems much more reasonable to me then producing heaps of logical styles,
  68. but..</P>
  69.  
  70. Note that you just created a container that requires an start- and
  71. end-tag.
  72.  
  73. <H2>Macros with custom attributes</H2>
  74.  
  75. Take a look at this example:
  76.  
  77. <$INCLUDE FILE="exmpl/m_next.hsc" SOURCE PRE> <* show macro *>
  78. <$INCLUDE FILE="exmpl/m_next.hsc">            <* define macro *>
  79.  
  80. This defines a macro that defines a button that references to the next page.
  81. As every page has its own next page, you can set one attribute for this macro:
  82. <CODE>NXTREF</CODE>, which is the URI that should be referenced as the "next"
  83. page.<P>
  84.  
  85. So an example usage of this macro would be:
  86. <$source PRE>
  87.   <BUTTON_NEXT NXTREF=":features/rplcent.html">
  88. </$source>
  89.  
  90. which will give the button seen below:<P>
  91.  
  92. <BUTTON_NEXT NXTREF=":features/rplcent.html"><P>
  93.  
  94. Note that the value of <CODE>NXTREF</CODE> is passed to the <CODE>HREF</CODE>
  95. attribute within the <TG>A</TG> tag when the macro is extracted.<P>
  96.  
  97.  
  98. If you wonder, what <CODE>HREF=(NxtRef)</CODE> (see above) should
  99. mean: This sets <CODE>HREF</CODE> with the value stored in
  100. <CODE>NxtRef</CODE>. For details, read the section about
  101. <A HREF=":features/expressions.html">expressions</A>.
  102.  
  103. <H2>Some Notes</H2>
  104.  
  105. Names for macros and attributes are case-insensitive.<P>
  106.  
  107. Macro attributes can only be defined within opening macros. The
  108. coresponding closing macro automatically inherits all attributes of
  109. its opening macro. This seems more HTML-like to me.<P>
  110.  
  111. SGML is able to handle macros.<P>
  112.  
  113. To make your macros more powerful and flexible, you can use
  114. <A HREF=":features/expressions.html">expressions</A> and
  115. <A HREF=":features/if.html">conditional conversion</A>.
  116. <P>
  117.  
  118. </WEBPAGE>
  119.  
  120.